<%--
	fileName      : usermgmt_add.jsp
	author        : KFZX-yuli1
	createDate    : 2010-6-7  上午10:42:31
	lastModifier  : KFZX-yuli1
	lastModifyDate: 2010-6-7  上午10:42:31
	description   : 用户新增和修改
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head> 
		<meta http-equiv="Content-Type" content="text/html; charsfet=UTF-8"/>
		<title>'<ctp:label key="branch.list.title.label"/>'</title>
		<ctp:include items='borderlayout,panel,groupbox,toolbar,textfield,button,gridlayout,multiselect,combobox,form,validator,textarea,label,radiogroup,checkbox,vwizard,message_ex,datepicker,checkboxgroup'/>
		<%@ include file="/uniform_attestation/ssicPub.jsp" %>		
		<%@ include file="/user/authExtUser.jsp" %>
		<script type='text/javascript' kind='variant'>	
			  
		    //================================UI变量定义片段============================================================
		    var ctpBorderlayout;//页面框架布局
		    var ctpForm;//用户表单
		    var ctpWizard;//页面向导
		    var ctpToolbar;//工具栏
		    var ctpGridlayout1;//第一页布局
		    var ctpGridlayout2;//第二页布局
		    var ctpGridlayout3;//第三页布局
		    var ctpSubLayout;//第二页布局器上的布局
		    var ctpId;//用户ID组件
		    var ctpName;//用户名称组件
		    var ctpPassword;//用户密码组件
		    var ctpPassword2;//重复输入密码组件
		    var ctpStatus;//状态组件
		    var ctpBranchName;//行名
		    var ctpPri;//用户权限
		    var ctpLevel;//用户维护级别
		    var ctpRole;//用户角色
		    var ctpDescription;//用户描述组件
		    var ctpPhoneNo;//电话号码组件
		    var ctpEmail;//电子邮件组件
		    var ctpAddress;//地址组件
		    var ctpPostcode;//邮政编码组件
		    var ctpDefaultRole;//默认用户角色 

		    var ctpBasicInfoGroupbox;
		    var ctpPwdInfoPanel;
		    var ctpPwdInfoGroupbox;
		    var ctpPanel;
	    </script>
        <script type='text/javascript' kind='event'>
      //  ctp.core.log.lvl = ctp.core.loglvl.obj;
        	//================================函数定义片段============================================================
        	var privSelf='0';//本级机构
        	var privAll='0';//所有机构
        	var ext_flag='0';
        	var userType='<ctp:out name="flowCtx.userType"/>';//用户状态，1代表新增0代表修改		
        	var userId='<ctp:out name="sessCtx.user.id"/>';//用户Id
        	var userIdSel='<ctp:out name="userId"/>';
        	var branchId='<ctp:out name="flowCtx.branchId"/>';//用户Id
        	var branchName='<ctp:out name="flowCtx.branchName"/>';//用户Name
        	var branchLevel='<ctp:out name="flowCtx.branchLevel"/>';//用户Level

        	var cbItems=[];
        	var defaultrolesel;//选择到的默认角色
        	var objId;
		    /**
             * toolbar取消按钮事件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
		    function toolbarCancel(){//返回操作
		    	var _mContext = "usermgmt_add.jsp -> toolbarCancel()";
                try {
                	document.resultjsp.flowActionName.value='userlistjsp';
                    document.resultjsp.submit();
                } 
                catch (e) {
                    ctp.core.log.err(_mContext, e.message);
                } 
			}
		    /**
             * 点击radio按钮触发事件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function radioOnchange(){
				var _mContext = "usermgmt_add.jsp -> radioOnchange()";
                try {
                	switch(ctpPri.getValue()){
						case 'normal':
							privAll='0';
				 			privSelf='0';
				 			ctpLevel.setValue('0');
				 			ctpLevel.setDisable(true);
							break;
						case 'all':
							privAll='1';
				 			privSelf='0';
				 			ctpLevel.setValue('0');
				 			ctpLevel.setDisable(true);
							break;
						case 'self':
							privAll='0';
				 			privSelf='1';
				 			ctpLevel.setDisable(false);
							break;
					}
					ctpForm.setHiddenValue("user.privilegeAll",privAll);
					ctpForm.setHiddenValue("user.privilegeSelf",privSelf);
                } 
                catch (e) {
                    ctp.core.log.err(_mContext, e.message);
                }
			}
			 /**
             * 点击radio按钮触发事件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function defaultRoleChange(){
				var _mContext = "usermgmt_add.jsp -> defaultRoleChange()";
                try {
               		defaultrolesel=ctpDefaultRole.getValue();

                	ctpDefaultRole.delAllItems();

					if(ctpRole.getSelectedObjs().length==0){
						ctpDefaultRole.setDisable(true);	
					}
					else{
						ctpDefaultRole.setDisable(false);
						ctpDefaultRole.newItems(ctpRole.getSelectedObjs());
						if(ctpRole.getJqObjByValue(defaultrolesel,'right')){
							ctpDefaultRole.setValue(defaultrolesel);
						}
						
					}
					
                } 
                catch (e) {
                    ctp.core.log.err(_mContext, e.message);
                }
			}
			/**
             * 点击上一步或下一步时触发
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function handler1(){
				var _mContext = "usermgmt_add.jsp -> handler1()";
                try {
					var boolResult;
					var index = ctpWizard.getCurStep();
					switch(index){
						case 0:
							boolResult = ctpValidator1.submitValidate();
							if(userType === '1'){
								//在密码控件里头获取password
								//ctpPassword = document.frames["user_password"].document.getElementById("pw_obj").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
								//ctpPassword2 = document.frames["user_password"].document.getElementById("pw_obj2").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
								ctpPassword = document.frames["user_password"].document.getElementById("pw_obj").value;
								ctpPassword2 = document.frames["user_password"].document.getElementById("pw_obj2").value;
								
								if(!ctpPassword || !ctpPassword2){
									alert('<ctp:label key="must_input_password"/>');//请输入密码
									boolResult = false;
								}else if(ctpPassword !== ctpPassword2){
									alert('<ctp:label key="not_matching_password"/>');//两次输入不一致,请重新输入
									boolResult = false;
								}
							}
							break;
						case 1:
							boolResult = ctpValidator2.submitValidate();
							break;
						case 2:
							boolResult = ctpValidator3.submitValidate();
							break;
						default:
							boolResult = true;
					}
					return boolResult?0:-1;
				}
	            catch (e) {
	                ctp.core.log.err(_mContext, e.message);
	            }
			}
            /**
             * 点击完成时触发函数 新增 修改用户
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function handler2(){
				var _mContext = "usermgmt_add.jsp -> handler2()";
	                try {
						var boolResult;
						var index = ctpWizard.getCurStep();
						switch(index){
							case 0:
								boolResult = ctpValidator1.submitValidate();
								if(userType === '1'){
									//在密码控件里头获取password
									//ctpPassword = document.frames["user_password"].document.getElementById("pw_obj").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
									//ctpPassword2 = document.frames["user_password"].document.getElementById("pw_obj2").CrpytPwd('C:\\Windows\\System32\\ICBC_CTP_1_00000_3DES_16');
									ctpPassword = document.frames["user_password"].document.getElementById("pw_obj").value;
									ctpPassword2 = document.frames["user_password"].document.getElementById("pw_obj2").value;
									
									if(!ctpPassword || !ctpPassword2){
										alert('<ctp:label key="must_input_password"/>');//请输入密码
										boolResult = false;
									}else if(ctpPassword !== ctpPassword2){
										alert('<ctp:label key="not_matching_password"/>');//两次输入不一致,请重新输入
										boolResult = false;
									}
								}
								break;
							case 1:
								boolResult = ctpValidator2.submitValidate();
								break;
							case 2:
								boolResult = ctpValidator3.submitValidate();
								break;
							default:
								boolResult = true;
						}
						if(boolResult){
							var _val = ctpRole.getValue();
							var _valArray = _val.split(',');
							var _varTurnArray = [];
							$.each(_valArray,function(i,_val){
								if(_val!=""){
								_varTurnArray.push('{"id":"'+_val+'"}');}
							});
							
							var _varTurn = '[' + _varTurnArray.join(",") + ']';
							
							//alert(_varTurn);
							ctpForm.setHiddenValue("userInRoleList",_varTurn);
							objId=ctpId.getValue();
							ctpForm.setHiddenValue("objId",objId);
							ctpForm.setHiddenValue("user.privilegeAll",privAll);
							ctpForm.setHiddenValue("user.privilegeSelf",privSelf);

							//将密码放入表单里头
							if(userType === '1'){
								ctpForm.setHiddenValue("user.password", ctpPassword);
							}
							if(userType=='1'){
		                    	document.useradd.flowActionName.value = 'userAddOp';
		                    }else if(userType=='0'){
		                    	document.useradd.flowActionName.value = 'userModifyOp';
		                    }
		                    	                    
		                    if(ctpForm.submitCheck()==false){ //表单校验
                    			 return;
                			 }  
							function submit(){
								ctpForm.submit();
							}
							if(('1'=='<ctp:out name="servCtx.authFlag"/>')&&('true'=='<ctp:out name="servCtx.enableSSIC"/>')){//判断是否需要统一认证双人授权	
								if(userType=='1'){
			             			result=ssicAuth('<ctp:out name="fullPath"/>user.flowc',ctpForm.getHiddenInputValue("flowActionName"),submit,"1");
								}else if(userType=='0'){//修改接口
									result=ssicAuth('<ctp:out name="fullPath"/>user.flowc',ctpForm.getHiddenInputValue("flowActionName"),submit,"3");
								}
				             	//调用统一认证双人授权接口           	
			            	}else{
			            		submit();
			            	}	
		                   		
						
						}
	                }
		            catch (e) {
		                ctp.core.log.err(_mContext, e.message);
		            }

			
			}
			
			  /**
             * 表单提交成功后执行的函数
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-lixy01           
             */
            function formSucc(data){
            	 var _mContext = "usermgmt_add.jsp -> formSucc()";
            	 try {
                	 var succMsg="";
                	 var errorMsg="";
                	 if(userType=="1"){//新增操作
                		 succMsg='<ctp:label key="user.new.alertMsg.newSucc"/>';//新增用户成功
                		 errorMsg='<ctp:label key="user.new.alertMsg.newFail"/>,<ctp:label key="errorCode"/>:'+data[0].errorCode+',<ctp:label key="errorMsg"/>:'+data[0].errorMsg;
                	 }
                	 if(userType=="0"){//修改操作
                		 succMsg='<ctp:label key="user.modify.alertMsg.modifySucc"/>';//修改用户成功
                		 errorMsg='<ctp:label key="user.modify.alertMsg.modifyFail"/>,<ctp:label key="errorCode"/>:'+data[0].errorCode+',<ctp:label key="errorMsg"/>:'+data[0].errorMsg;
                	 }
            		 if(data[0].out_flag=="0"){//提交成功        
            			 if(userType === '1'){
                			 alert(succMsg);//密码框，只能用alert
                			 document.resultjsp.submit();
            			 }else{
	                         ctpMSB.succeed({message:succMsg,handler:function(){
	                  	 	 document.resultjsp.submit();}});
                		 }                                      
                         
                     }else{
                    	 if(userType === '1'){
                        	 alert(errorMsg);
                    	 }else{
                         	ctpMSB.error({message:errorMsg});//提交失败，停留在原页面
                      	 }
                     }                        
            	 }
            	 catch (e) {
                     ctp.core.log.err(_mContext, e.message);
                 }            	 
            }
			/**
             * 加载JSP页面
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function initJSP(){
				var _fnContext = "usermgmt_add.jsp" + "->initJSP()";
			    try {
			    	extItemSet();//加载扩展属性
			    	
			    	setUserValue();//加载用户信息
			    	
			    	//加载验证框架，执行顺序在当前页面的校验
			    	ctpValidator1 = new ctp.validator({
			    		promptPosition: 'topRight',
		               	target: ctpWizard.getValidateArray(0),
		               	container:ctpWizard.getContentJqDom(0)
	                }); 
	             
	                ctpValidator2 = new ctp.validator({
	                	promptPosition: 'topRight',
		               	target: ctpWizard.getValidateArray(1),
		               	container:ctpWizard.getContentJqDom(1)
	                }); 
	                ctpValidator3 = new ctp.validator({
	                	promptPosition: 'topRight',
		               	target: ctpWizard.getValidateArray(2),
		               	container:ctpWizard.getContentJqDom(2)
	                }); 
			    	
			    } 
			    catch (e) {
			        ctp.core.log.err(_fnContext, e.message);
			    }  
			}
			/**
             * 加载JSP页面COMBOBOX内容
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function initCOMBOBOX(){
			
				var _fnContext = "usermgmt_add.jsp" + "->initCOMBOBOX()";
			    try {
			    	var levs;				    	
	                var ret = ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="getbranchdepop" params="branchId=flowCtx.branchId;"/>');
	                if(ret[0].out_flag && ret[0].out_flag=='0'){
	                	levs = ret[0].branchDep;
	                }else{
	                	levs = 0;
	                }
											                
	           	 	cbItems.push({text:'<ctp:label key="select_role_level" />',value:'0',selected: true});
	           	 	for(var i=0;i<levs;i++){
	           		 	cbItems.push({text:'<ctp:label key="can_manage" /><ctp:label key="underline" />'+(i+1)+'<ctp:label key="level" />',value: (i+1)+''});
	           	 	}
			    } 
			    catch (e) {
			        ctp.core.log.err(_fnContext, e.message);
			    }  
			}			
			
			
			
			/**
             * 设置用户信息
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function setUserValue(){
				var _fnContext = "usermgmt_add.jsp" + "->setUserValue()";
			    try {
			    	var roleurl;
			    	if(userType=='1'){//走新增流程
			    		roleurl='<ctp:url href="user.flowc" flowActionName="userPreAddOp" />&userId= &branchId='+branchId+'&branchLevel='+branchLevel;
			    		ctpRole.reloadData({'url':roleurl});
				    }
			    	else if(userType=='0'){//走修改流程
			    		
			    		objId=userIdSel;
			    		roleurl='<ctp:url href="user.flowc" flowActionName="userPreAddOp" />&userId='+userIdSel+'&branchId='+branchId+'&branchLevel='+branchLevel;
			    		//alert(ctp.data.jsonToStr(ctp.data.getJSON(roleurl)));
		    			ctpRole.reloadData({'url':roleurl});
			    		//var extData=ajaxRequest('<ctp:url href="user.flowc" flowActionName="userPreModifyOp"/>&userId='+userIdSel);//取得角色表扩展属性数据
			    		var extData=ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="userPreModifyOp"/>&userId='+userIdSel);//取得角色表扩展属性数据
			    		ctpId.setValue(extData.id);

			    		ctpId.setDisable(true);
						ctpName.setValue(extData.name);
						ctpGridlayout1.delObjs(['lbPassword', 'lbPassword2', 'password', 'password2']);//删掉输入密码，修改用户不允许修改用户密码
						
						ctpStatus.setValue(extData.status);
						privAll=extData.privilegeAll;
						privSelf=extData.privilegeSelf;
	
						ctpLevel.setValue(extData.privilegeOther);
						
						//}
						if(extData.privilegeAll=='1'){
							ctpPri.setValue('all');
						}else if(extData.privilegeSelf=='1'){
							
							ctpLevel.setDisable(false);
							ctpPri.setValue('self');
						}else{
							ctpPri.setValue('normal');
						}
						
						if(ctpRole.getSelectedObjs().length!=0)
						{
							ctpDefaultRole.setDisable(false);
							ctpDefaultRole.newItems(ctpRole.getSelectedObjs());
							ctpDefaultRole.setValue(extData.userDefaultRole);
						}
						
						ctpDescription.setValue(extData.description);
						ctpPhoneNo.setValue(extData.phoneNo);
						ctpEmail.setValue(extData.email);
						ctpAddress.setValue(extData.address);
						ctpPostcode.setValue(extData.postcode);
				    }
				    	
				    	
				    	 if(ext_flag=="1"){//如果有扩展数据对其赋值
				    	 	
						    var extData=ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="queryUserExtData"/>&objId='+objId);
						    if(extData.length>0&&extData[0].errorCode){
						    	if(userType === '1'){
							    	alert('<ctp:label key="query_user_extdata_error"/>,<ctp:label key="errorCode"/>:'+extData[0].errorCode+',<ctp:label key="errorMsg"/>:'+extData[0].errorMsg);
						    	}else{
							    	ctpMSB.error({message:'<ctp:label key="query_user_extdata_error"/>,<ctp:label key="errorCode"/>:'+extData[0].errorCode+',<ctp:label key="errorMsg"/>:'+extData[0].errorMsg});
							    }
	                        }
	                        setExtValue(ctpForm,extProperty,extData);//设置扩展数据		      
						 }
			    } 
			    catch (e) {
			        ctp.core.log.err(_fnContext, e.message);
			    }  
			}
			/**
             * 加载扩展属性
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */
			function extItemSet(){
				var _fnContext = "usermgmt_add.jsp" + "->extItemSet()";
			    try {
			   		
			    	//判断是否有扩展属性,有则加载
			    	extProperty=ctp.data.getJSON('<ctp:url href="user.flowc" flowActionName="extqueryop"/>');
					//var extProperty=ajaxRequest('<ctp:url href="user.flowc" flowActionName="extqueryop"/>');//取得用户表扩展属性	               
				 	  if(extProperty.length>0){
				   		  if(extProperty[0].errorCode){ //查询扩展属性
					   		  if(userType === '1'){
						   		  alert('<ctp:label key="query_user_extlist_error"/>,<ctp:label key="errorCode"/>:'+extProperty[0].errorCode+',<ctp:label key="errorMsg"/>:'+extProperty[0].errorMsg);
					   		  }else{
	                              ctpMSB.error({message:'<ctp:label key="query_user_extlist_error"/>,<ctp:label key="errorCode"/>:'+extProperty[0].errorCode+',<ctp:label key="errorMsg"/>:'+extProperty[0].errorMsg});
						   	  }
                          }
				   		 else{                	
				    	
				         	var count=extProperty[0].totalNum;
				         	if(count>0){
				         		ext_flag="1";
				         		ctpForm.setHiddenValue("ext_flag","1");//设置表单扩展属性标志         	                    	                       	
				         		$.each(extProperty, function(i, ext){
				           		     if(i>0){//忽略第一个数据totalNum
				               		     var extProId=ext.id;//扩展属性ID
				           		         var extProName=ext.name;//扩展属性名称
				           		         var extProTable=ext.table;//扩展表
				           		         var extProType=ext.type;//扩展属性类型 
				           		         var extProDefaultValue=ext.defaultvalue;//缺省值，当属性为combobox、radiogroup、checkboxgroup 类型时，代表备选项，以分号";"分隔，放置在第一位的为缺省显示项 
				           		         var extProRequired=ext.required;//是否为必填，1：必填，0：可选
				           		         var extProDesc=ext.desc;//属性描述
				           		         var extProValidcheck=ext.validcheck;//合法性校验
				           		         var extProFormat=ext.format;//数据格式
				           		      	 var selectKeyValue=ext.selectKeyValue;
				           		         createExtItem(ctpForm,ctpGridlayout3,extProId,extProName,extProType,extProDefaultValue,extProRequired,extProDesc,extProValidcheck,extProFormat,selectKeyValue);
				           		     }
				           	    });
				         	}else{
				         		ext_flag="0";
				         		ctpForm.setHiddenValue("ext_flag","0");//设置表单扩展属性标志
				         	}
				         }
				     }
					 
			    } 
			    catch (e) {
			        ctp.core.log.err(_fnContext, e.message);
			    }  
			}
        </script>
        <script type='text/javascript' kind='notUi'>
      		//================================非UI组件定义片段==========================================================
        	var ctpValidator1;//首页布局校验
		    var ctpValidator2;//第二页布局校验
		    var ctpValidator3;//第三页布局校验
        </script>
        <script type='text/javascript' kind='ui'>
		    //================================UI组件定义片段============================================================
		    //ctp.core.log.lvl = ctp.core.loglvl.obj; //需要进行调试时启用
		    /**
             * 创建UI组件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1           
             */		    
		    function initUI(){
		    	var _mContext = "usermgmt_add.jsp -> initUI()";
           	 	try {	           	 	
               	 	var gridlayoutItems = [];
	           	 	ctpToolbar=new ctp.ui.toolbar({
		         		id : 'toolbarId',			
		         		border : 'bottom',			
		         	    leftItems :[
		    		    	{
			         			id:"botton2",
			         	        type : 'button',
			         	        text : '<ctp:label key="canclebutton"/>',
			         	        icon : 'back',
			         	        useable : true,
			         	        onClick : toolbarCancel
				         	}
				        ]
		         	});
	           		//创建表单对象
	           		ctpBranchName = new ctp.ui.label({id:'branchName',beanName:'user',submit:false,width: '100%',text:branchName});
		    		ctpId = new ctp.ui.textfield({id:"id",beanName:'user',width: '100%',validate:'rules[required,length[0,20],letterOrNumber,notValidInputText]'});
		    		ctpName = new ctp.ui.textfield({id:"name",beanName:'user',width: '100%',validate:'rules[required,length[0,50],notValidInputText]'});
		    		
		    		ctpStatus = new ctp.ui.combobox({id:"status",beanName:'user',validate:'rules[required]',width:'100%',items:[{text:'<ctp:label key="activation"/>',value:'1',selected:true},{text:'<ctp:label key="freeze"/>',value:'0'}]});
		    		
		    		ctpPri = new ctp.ui.radiogroup({submit:false,display:'cols',width: '100%',onChange:radioOnchange,items:[{id: 'radio1',label:'<ctp:label key="simple_user"/>',value:'normal',checked:true},{id: 'radio2',label:'<ctp:label key="all_branch"/>',value:'all'},{id: 'radio3',label:'<ctp:label key="this_branch"/>',value:'self'}]});
		    		ctpLevel = new ctp.ui.combobox({id:"privilegeOther",beanName:'user',width: '100%',submit:true,disabled:true,items:cbItems});
		    		ctpRole = new ctp.ui.multiselect({width: '100%',submit:false,onChange:defaultRoleChange});		    		
		    		ctpDefaultRole=new ctp.ui.combobox({id:"userDefaultRole",beanName:'user',width: '100%',submit:true,disabled:true});
		    		ctpDescription = new ctp.ui.textfield({id:"description",beanName:'user',width: '100%',validate:'rules[length[0,500],notValidInputText]'});
		    		ctpPhoneNo = new ctp.ui.textfield({id:"phoneNo",beanName:'user',width: '100%',validate:'rules[length[0,20],telephone,notValidInputText]'});
		    		ctpEmail = new ctp.ui.textfield({id:"email",beanName:'user',width: '100%',validate:'rules[email,length[0,50],notValidInputText1]'});
		    		ctpAddress = new ctp.ui.textfield({id:"address",beanName:'user',width: '100%',validate:'rules[length[0,500],notValidInputText]'});
		    		ctpPostcode = new ctp.ui.textfield({id:"postcode",beanName:'user',width: '100%',validate:'rules[zipcode,notValidInputText]'});

		    		gridlayoutItems.push([{align: 'left',label:{id:'lbBranchName',text: '<ctp:label key="branch.branchPName.label"/>'+':'},element: ctpBranchName}]);
	    			gridlayoutItems.push([{label:{id:'lbId',text: '<ctp:label key="user.userId.label"/><span style="color:red;">*</span>'+':'},element: ctpId}]);
	    			gridlayoutItems.push([{label:{id:'lbName',text: '<ctp:label key="user.userName.label"/><span style="color:red;">*</span>'+':'},element: ctpName}]);
	    			gridlayoutItems.push([{align: 'left',label:{id:'lbStatus',text: '<ctp:label key="user.userState.label"/><span style="color:red;">*</span>'+':'},element: ctpStatus}]);
	    			
	           	 	ctpGridlayout1 = new ctp.ui.gridlayout({
	                    id: 'gridlayout1',
						width: '100%',
						align: 'center',
						cols: 1,
						colSpace: 30,
						defaults: {label:{width:'100px'}},
						items: gridlayoutItems
						
	                });
	           	 	ctpSubLayout = new ctp.ui.gridlayout({
	           	 	    id: 'ctpSubLayout',
			        	width: '100%',
			        	align: 'center',
			        	colSpace: 30,
			        	cols: 3,
			        	defaults: {label:{width:'100px'}},
			        	items: [
			        		[{colspan: 2,label:{id:'lbLevel',text: '<ctp:label key="user.priOther.label"/>'+':'},element: ctpPri},{element: ctpLevel}]
			        	]
			        });		
	           	 	ctpGridlayout2 = new ctp.ui.gridlayout({
	                    id: 'gridlayout2',
						width: '90%',
						align: 'center',
						cols: 1,
						colSpace: 30,
						defaults: {label:{width:'100px'}},
						items: [
							[{element: ctpSubLayout}],
							[{label:{id:'lbDefaultRole',text: '<ctp:label key="choose_defaultrole"/>'+':'},element: ctpDefaultRole}],
							[{label:{id:'lbRole',text: '<ctp:label key="user_role"/>'+':'},element: ctpRole}]
							
						]
	                });
	           	 	ctpGridlayout3 = new ctp.ui.gridlayout({
	                    id: 'gridlayout3',
						width: '80%',
						align: 'center',
						colSpace: 30,
						cols: 1,
						defaults: {label:{width:'100px'}},
						items: [
							[{label:{id:'lbDes',text: '<ctp:label key="user.userDes.label"/>'+':'},element: ctpDescription}],
							[{label:{id:'lbPhoneNo',text: '<ctp:label key="user.userPhone.label"/>'+':'},element: ctpPhoneNo}],
							[{label:{id:'lbEmail',text: '<ctp:label key="user.userEmail.label"/>'+':'},element: ctpEmail}],
							[{label:{id:'lbAddress',text: '<ctp:label key="user.userAddress.label"/>'+':'},element: ctpAddress}],
							[{label:{id:'lbPostcode',text: '<ctp:label key="user.userPostcode.label"/>'+':'},element: ctpPostcode}]
						]
	                });

	           	 	var panelItem = [];
	           	 	ctpBasicInfoGroupbox = new ctp.ui.groupbox({
		           	 	id: 'ctpBasicInfoGroupbox', 
		           	 	width: '100%',
		           	 	title: '<ctp:label key="basic_info"/>',//基本信息
		           	 	items: [ctpGridlayout1]
	           	 	});

	           	 	panelItem.push(ctpBasicInfoGroupbox);

	           	 	if(userType === '1'){
		    			//1代表新增，只有新增才有密码输入
		    			var iframeSrc = '<ctp:url href="user.flowc" flowActionName="password" />';
		    			ctpPwdInfoPanel = new ctp.ui.panel({
			    			id: 'ctpPwdInfoPanel',
			    			style: 'none',
			    			width: '100%',
			    			height: '120px',
			    			contentPadding: '0px',
			    			bodyPadding: '0px',
			    			visible: 'hidden',
			    			html: '<iframe id="user_password" marginheight="0" marginwidth="0" width="100%" height="100%" frameborder="0" scrolling="no" src="' + iframeSrc + '"></iframe>'
			    		});
			    		
		    			ctpPwdInfoGroupbox = new ctp.ui.groupbox({
			           	 	id: 'ctpPwdInfoGroupbox',
			           	 	width: '100%',
			           	 	title: '<ctp:label key="password_setting"/>',//密码设置
			           	 	items: [ctpPwdInfoPanel]
		           	 	});

		           	 	panelItem.push(ctpPwdInfoGroupbox);
			    	}

	           	 	//居中用
			    	ctpPanel = new ctp.ui.panel({
				    	id: 'ctpPanel',
				    	style: 'none',
				    	width: '80%',
				    	height: 'auto',
				    	align: 'center',
				    	items: panelItem
			    	});
	                
	           	 	ctpWizard = new ctp.ui.vwizard({
                    	id: 'wizardId',
                    	title: userType=='1'?'<ctp:label key="user.add.title.label"/>':'<ctp:label key="user.lastModifyUser.label"/>',
                    	left: true,
                    	steps: [
                            {
	                        	title: '<ctp:label key="basic_info"/>',
	                        	nextBtn: {
		                            text: '<ctp:label key="next"/>',
		                            valid: true,
		                            onClick: handler1
		                        },
		                        finishBtn: {
		                            text: '<ctp:label key="finish"/>',
		                            valid: true,
		                            onClick: handler2
		                        },
								items: [ctpPanel]
                     		},{
                         		title: '<ctp:label key="role_privelege"/>',
                         		prevBtn: {
		                            text: '<ctp:label key="back"/>',
		                            valid: true,
		                            onClick: handler1
		                        },
                         		nextBtn: {
		                            text:  '<ctp:label key="next"/>',
		                            valid: true,
		                            onClick: handler1
		                        },
	                         	finishBtn: {
		                            text: '<ctp:label key="finish"/>',
		                            valid: true,
		                            onClick: handler2
		                        },
						  		items: [ctpGridlayout2]
                     		},{
		                        title: '<ctp:label key="add_info"/>',
		                        prevBtn: {
		                            text: '<ctp:label key="back"/>',
		                            valid: true,
		                            onClick: handler1
		                        },
		                        nextBtn: {
		                            text:  '<ctp:label key="next"/>',
		                            valid: true,
		                            onClick: handler1
		                        },

		                        finishBtn: {
		                            text:'<ctp:label key="finish"/>',
		                            valid: true,
		                            onClick: handler2
		                        },
		                        items: [ctpGridlayout3]
		                    }
		                ],
                     	width: '100%',
                     	height: '100%'
                 	});

       				ctpForm = new ctp.form({
		                id: 'useradd',
		                width: '100%', //宽度
		                height: '100%', //高度
						postType:'ajax',			        
    				    ajaxPostParam:{success: formSucc} ,
		                items: [ctpWizard]
		           });
       				ctpBorderlayout = new ctp.ui.borderlayout({
	                    type: "1C",
	                    center__items:[ctpToolbar,ctpForm],
	                    renderTo:'body'
	                });   
           	 	}	
	        	catch (e) {
	            	ctp.core.log.err(_mContext, e.message);
	            }
			}
		</script>
</head>
<body onload='initCOMBOBOX();initUI();initJSP();'>	  


<ctp:form name="useradd" method="post" action="user.flowc" flowActionName="userAddOp">
		<input type="hidden" name="ext_flag" value="0" />
		<input type="hidden" name="objId" />
		<input type="hidden" name="user.privilegeAll" value="0" />
		<input type="hidden" name="user.privilegeSelf" value="0" />
		<input type="hidden" name="json.userInRoleList" id='userInRoleList' />
		<input type="hidden" name="user.password" value="" />
		
</ctp:form> 

<ctp:form name="resultjsp" method="post" action="user.flowc" flowActionName="userlistjsp">

</ctp:form>  

</body>
</html>

<%--
	date        :
	modifyReason:
--%>